import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 宣教信息 */
export interface PublicityEducation {
          id: number; // 宣教ID
          title?: string; // 标题
          clsId?: number; // 所属分类ID
          content?: string; // 内容详情
          authorName?: string; // 作者名
          authorAvatar?: string; // 作者头像
          lookCount?: number; // 浏览量
  }

// 宣教 API
export const PublicityEducationApi = {
  // 查询宣教分页
  getPublicityEducationPage: async (params: any) => {
    return await request.get({ url: `/business/publicity-education/page`, params })
  },

  // 查询宣教详情
  getPublicityEducation: async (id: number) => {
    return await request.get({ url: `/business/publicity-education/get?id=` + id })
  },

  // 新增宣教
  createPublicityEducation: async (data: PublicityEducation) => {
    return await request.post({ url: `/business/publicity-education/create`, data })
  },

  // 修改宣教
  updatePublicityEducation: async (data: PublicityEducation) => {
    return await request.put({ url: `/business/publicity-education/update`, data })
  },

  // 删除宣教
  deletePublicityEducation: async (id: number) => {
    return await request.delete({ url: `/business/publicity-education/delete?id=` + id })
  },

  /** 批量删除宣教 */
  deletePublicityEducationList: async (ids: number[]) => {
    return await request.delete({ url: `/business/publicity-education/delete-list?ids=${ids.join(',')}` })
  },

  // 导出宣教 Excel
  exportPublicityEducation: async (params) => {
    return await request.download({ url: `/business/publicity-education/export-excel`, params })
  },
}